package com.raverun.imovies.jadeditor;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IPersistableElement;

public class MyFileEditorInput implements IPersistableElement, IPathEditorInput
{
    private IFile mFile;
    
    public MyFileEditorInput( IFile file )
    {
        mFile = file;
    }
    
    public String getFactoryId()
    {
        return null;
    }

    public void saveState( IMemento memento )
    {
        System.out.println( "saveState called" );
    }

    public boolean exists()
    {
        return mFile.exists();
    }

    public ImageDescriptor getImageDescriptor()
    {
        return null;
    }

    public String getName()
    {
        return mFile.getName();
    }

    public IPersistableElement getPersistable()
    {
        return this;
    }

    public String getToolTipText()
    {
        return mFile.getFullPath().makeRelative().toString();
    }

    public Object getAdapter( Class adapter )
    {
        return null;
    }

    public IPath getPath()
    {
        return mFile.getLocation();
    }

}
